CC= gcc
# CFLAGS= -Wall -pedantic -ansi|
CFLAGS= -Wall -pedantic -ansi -D_GNU_SOURCE -std=c99 ${M}
OBJECTS = simSet.o raceSet.o carSet.o controlSet.o dynamicSet.o weatherSet.o modeling.o read_route.o write_route.o solpos.o

all: ssm peukert ventilation test_route setStructures

test: test-simSet test_carTest
	./test-simSet > test-simSet.testout
	diff test-simSet.testout testconst/test-simSet.testconst

ssm: ssm.c ssm_conversions.h ssm_3.h ${OBJECTS}
	${CC} ${CFLAGS} -o ssm ${OBJECTS} ssm.c -lm

peukert: peukert.c ssm_conversions.h
	${CC} ${CFLAGS} -o peukert peukert.c -lm

ventilation: ventilation.c ssm_conversions.h
	${CC} ${CFLAGS} -o ventilation ventilation.c -lm

test_route: test_route.o read_route.o write_route.o
	${CC} -o test_route test_route.o read_route.o write_route.o
	cp test_route TEST/

test_route.o: test_route.c ssm.h
	${CC} ${CFLAGS} -c test_route.c

read_route.o: read_route.c ssm.h
	${CC} ${CFLAGS} -c read_route.c

write_route.o: write_route.c ssm.h
	${CC} ${CFLAGS} -c write_route.c

simSet.o: simSet.c ssm.h
	${CC} ${CFLAGS} -c simSet.c

raceSet.o: raceSet.c ssm.h ssm_conversions.h
	${CC} ${CFLAGS} -c raceSet.c

carSet.o: carSet.c ssm.h
	${CC} ${CFLAGS} -c carSet.c

controlSet.o: controlSet.c ssm.h
	${CC} ${CFLAGS} -c controlSet.c

dynamicSet.o: dynamicSet.c ssm.h
	${CC} ${CFLAGS} -c dynamicSet.c

weatherSet.o: weatherSet.c ssm.h
	${CC} ${CFLAGS} -c weatherSet.c

modeling.o: modeling.c ssm.h
	${CC} ${CFLAGS} -c modeling.c

solpos.o: solpos/solpos.c solpos/solpos00.h
	${CC} ${CFLAGS} -c solpos/solpos.c

setStructures: setStructures.c ssm.h ${OBJECTS}
	${CC} ${CFLAGS} -o setStructures ${OBJECTS} setStructures.c -lm

test-simSet: test-simSet.c ssm.h simSet.o
	${CC} ${CFLAGS} -o test-simSet ${OBJECTS} test-simSet.c

test-carSet: test_carSet.c ssm.h simSet.o
	${CC} ${CFLAGS} -o test_carSet ${OBJECTS} test_carSet.c



*.o: ssm.h

ttest: ttest.c
	${CC} ${CFLAGS} -o ttest ttest.c

clean:
	rm -f *.o core a.out simset ssm peukert test_route ventilation
